<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: BurstApplLayerBattery Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00041.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a>  </div>
  <div class="headertitle">
<div class="title">BurstApplLayerBattery Class Reference<div class="ingroups"><a class="el" href="a00506.html">applLayer - application layer modules</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="BurstApplLayerBattery" --><!-- doxytag: inherits="BurstApplLayer" -->
<p>Application layer to test lower layer implementations.  
 <a href="a00041.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00412_source.html">BurstApplLayerBattery.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for BurstApplLayerBattery:</div>
<div class="dyncontent">
<div class="center"><img src="a00627.png" border="0" usemap="#BurstApplLayerBattery_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for BurstApplLayerBattery:</div>
<div class="dyncontent">
<div class="center"><img src="a00628.png" border="0" usemap="#BurstApplLayerBattery_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00629.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8ccaf74e9a310c5f45447283df6dee7e"></a><!-- doxytag: member="BurstApplLayerBattery::initialize" ref="a8ccaf74e9a310c5f45447283df6dee7e" args="(int)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00041.html#a8ccaf74e9a310c5f45447283df6dee7e">initialize</a> (int)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialite module parameters. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa3413a8e1ebfbd7630b7389dc4d7f211"></a><!-- doxytag: member="BurstApplLayerBattery::finish" ref="aa3413a8e1ebfbd7630b7389dc4d7f211" args="()" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00041.html#aa3413a8e1ebfbd7630b7389dc4d7f211">finish</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when the simulation has finished. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00041.html#a844beeae7f5dd04a628538b1b9fead02">handleHostState</a> (const <a class="el" href="a00098.html">HostState</a> &amp;state)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called whenever the hosts state changes.  <a href="#a844beeae7f5dd04a628538b1b9fead02"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00041.html#a66a2f76f5f30f1920dc65f00a6fd1ac3">handleLowerMsg</a> (cMessage *)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle messages from lower layer.  <a href="#a66a2f76f5f30f1920dc65f00a6fd1ac3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa50363ece763f8c35957ce60fab0d9a3"></a><!-- doxytag: member="BurstApplLayerBattery::handleSelfMsg" ref="aa50363ece763f8c35957ce60fab0d9a3" args="(cMessage *)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00041.html#aa50363ece763f8c35957ce60fab0d9a3">handleSelfMsg</a> (cMessage *)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handle self messages such as timer... <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afe3e5af417f294628cbaa8594542ab38"></a><!-- doxytag: member="BurstApplLayerBattery::bcastOut" ref="afe3e5af417f294628cbaa8594542ab38" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00041.html#afe3e5af417f294628cbaa8594542ab38">bcastOut</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of broadcasts queued so far. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad6a44e7b94755befebf39fde55643828"></a><!-- doxytag: member="BurstApplLayerBattery::replyOut" ref="ad6a44e7b94755befebf39fde55643828" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00041.html#ad6a44e7b94755befebf39fde55643828">replyOut</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of replies sent so far. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac5175743d144b772c7aa76bfcfacbc3a"></a><!-- doxytag: member="BurstApplLayerBattery::replyIn" ref="ac5175743d144b772c7aa76bfcfacbc3a" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00041.html#ac5175743d144b772c7aa76bfcfacbc3a">replyIn</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of replies received so far. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Application layer to test lower layer implementations. </p>
<p>This application layer does exactly the same as the <a class="el" href="a00208.html" title="Test class for the application layer.">TestApplLayer</a>. The only difference is that is sends a burst of broadcast messages instead of just one. The burst size is specified in burstSize and can be set in omnetpp.ini</p>
<dl class="see"><dt><b>See also:</b></dt><dd>TestApplALyer</dd></dl>
<dl class="author"><dt><b>Author:</b></dt><dd>Daniel Willkomm </dd></dl>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a844beeae7f5dd04a628538b1b9fead02"></a><!-- doxytag: member="BurstApplLayerBattery::handleHostState" ref="a844beeae7f5dd04a628538b1b9fead02" args="(const HostState &amp;state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BurstApplLayerBattery::handleHostState </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00098.html">HostState</a> &amp;&#160;</td>
          <td class="paramname"><em>state</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Called whenever the hosts state changes. </p>
<p>Default implementation of this method throws an error whenever the host state changes and the "notAffectedbyHostState" variable is not explicitly set. This is because every module of a host has to make sure to react well to changes in the host state. Or it has to explicitly set its parameter "notAffectedbyHostState" to true. </p>

<p>Reimplemented from <a class="el" href="a00027.html#a44220aa650488eee8ad121f8bc599265">BaseModule</a>.</p>

<p>References <a class="el" href="a00208.html#ae46c2fd464821d8ffb07fc0588623d23">TestApplLayer::delayTimer</a>, <a class="el" href="a00098.html#a5002302e0f07bbd982c6e5d65eaa9c3ca1a8705dd49a3297fc8512a1ac63b78e7">HostState::FAILED</a>, and <a class="el" href="a00098.html#a3167de707748fd5280fce231d6cbcf90">HostState::get()</a>.</p>
<div class="fragment"><pre class="fragment">{
    <a class="code" href="a00098.html#a5002302e0f07bbd982c6e5d65eaa9c3c" title="Possible host states.">HostState::States</a> hostState = state.<a class="code" href="a00098.html#a3167de707748fd5280fce231d6cbcf90" title="Returns the host state.">get</a>();

    <span class="keywordflow">switch</span> (hostState)
    {
        <span class="keywordflow">case</span> <a class="code" href="a00098.html#a5002302e0f07bbd982c6e5d65eaa9c3ca1a8705dd49a3297fc8512a1ac63b78e7">HostState::FAILED</a>:
            debugEV &lt;&lt; <span class="stringliteral">&quot;t = &quot;</span> &lt;&lt; simTime() &lt;&lt; <span class="stringliteral">&quot; host state FAILED&quot;</span> &lt;&lt; endl;
            recordScalar(<span class="stringliteral">&quot;HostState::FAILED&quot;</span>, simTime());

            <span class="comment">// BurstApplLayer sends all its frames to the MAC layer at</span>
            <span class="comment">// once, so this happens only if the battery fails before the</span>
            <span class="comment">// burst.  Frames that are already sendDown() are stopped at</span>
            <span class="comment">// the SnrEval.</span>

            <span class="comment">// battery is depleted, stop events</span>
            <span class="keywordflow">if</span> (<a class="code" href="a00208.html#ae46c2fd464821d8ffb07fc0588623d23" title="Timer message for scheduling next message.">delayTimer</a>-&gt;isScheduled())
            {
                debugEV &lt;&lt; <span class="stringliteral">&quot;canceling frame burst&quot;</span> &lt;&lt; endl;
                cancelEvent(<a class="code" href="a00208.html#ae46c2fd464821d8ffb07fc0588623d23" title="Timer message for scheduling next message.">delayTimer</a>);
            }
            <span class="keywordflow">break</span>;
        <span class="keywordflow">default</span>:
            <span class="comment">// ON/OFF aren&#39;t used</span>
            <span class="keywordflow">break</span>;
    }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a66a2f76f5f30f1920dc65f00a6fd1ac3"></a><!-- doxytag: member="BurstApplLayerBattery::handleLowerMsg" ref="a66a2f76f5f30f1920dc65f00a6fd1ac3" args="(cMessage *)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BurstApplLayerBattery::handleLowerMsg </td>
          <td>(</td>
          <td class="paramtype">cMessage *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Handle messages from lower layer. </p>
<p>There are two kinds of messages that can arrive at this module: The first (kind = BROADCAST_MESSAGE) is a broadcast packet from a neighbor node to which we have to send a reply (if bSendReply is true). The second (kind = BROADCAST_REPLY_MESSAGE) is a reply to a broadcast packet that we have send and just causes some output before it is deleted </p>

<p>Reimplemented from <a class="el" href="a00040.html#aaaf45ab3db0685c695394ea862a3d79f">BurstApplLayer</a>.</p>

<p>References <a class="el" href="a00041.html#ac5175743d144b772c7aa76bfcfacbc3a">replyIn</a>, <a class="el" href="a00041.html#ad6a44e7b94755befebf39fde55643828">replyOut</a>, and <a class="el" href="a00208.html#af1d3f3a3be9478119f118beeb5b4ad85">TestApplLayer::sendReply()</a>.</p>
<div class="fragment"><pre class="fragment">{
    ApplPkt *m;

    <span class="keywordflow">switch</span> (msg-&gt;getKind())
    {
        <span class="keywordflow">case</span> BROADCAST_MESSAGE:
            m = <span class="keyword">static_cast&lt;</span>ApplPkt *<span class="keyword">&gt;</span>(msg);
            debugEV &lt;&lt; <span class="stringliteral">&quot;Received a broadcast packet from host[&quot;</span> &lt;&lt; m-&gt;getSrcAddr() &lt;&lt; <span class="stringliteral">&quot;] -&gt; sending reply\n&quot;</span>;
            <a class="code" href="a00041.html#ad6a44e7b94755befebf39fde55643828" title="The number of replies sent so far.">replyOut</a> += 1;
            debugEV &lt;&lt; simTime() &lt;&lt; <span class="stringliteral">&quot;: replyOut = &quot;</span> &lt;&lt; <a class="code" href="a00041.html#ad6a44e7b94755befebf39fde55643828" title="The number of replies sent so far.">replyOut</a> &lt;&lt; endl;
            <a class="code" href="a00208.html#af1d3f3a3be9478119f118beeb5b4ad85" title="send a reply to a broadcast message">sendReply</a>(m);
            <span class="keywordflow">break</span>;
        <span class="keywordflow">case</span> BROADCAST_REPLY_MESSAGE:
            m = <span class="keyword">static_cast&lt;</span>ApplPkt *<span class="keyword">&gt;</span>(msg);
            debugEV &lt;&lt; <span class="stringliteral">&quot;Received reply from host[&quot;</span> &lt;&lt; m-&gt;getSrcAddr() &lt;&lt; <span class="stringliteral">&quot;]; delete msg\n&quot;</span>;
            <a class="code" href="a00041.html#ac5175743d144b772c7aa76bfcfacbc3a" title="The number of replies received so far.">replyIn</a> += 1;
            debugEV &lt;&lt; simTime() &lt;&lt; <span class="stringliteral">&quot;: replyIn = &quot;</span> &lt;&lt; <a class="code" href="a00041.html#ac5175743d144b772c7aa76bfcfacbc3a" title="The number of replies received so far.">replyIn</a> &lt;&lt; endl;
            <span class="keyword">delete</span> msg;
            <span class="keywordflow">break</span>;
        <span class="keywordflow">default</span>:
            EV &lt;&lt; <span class="stringliteral">&quot;Error! got packet with unknown kind: &quot;</span> &lt;&lt; msg-&gt;getKind() &lt;&lt; endl;
            <span class="keywordflow">break</span>;
    }
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/application/<a class="el" href="a00412_source.html">BurstApplLayerBattery.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/application/BurstApplLayerBattery.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00041.html">BurstApplLayerBattery</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:31 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
